extern time_t gpsbabel_now; /* gpsbabel startup-time; initialized in main.c with time() */
extern time_t gpsbabel_time; /* gpsbabel startup-time; initialized in main.c with current_time(), ! ZERO within testo ! */
+#define CENTI_TO_MICRO(t) (t * 10000) /* Centiseconds to Microseconds */
+#define MICRO_TO_CENTI(t) (t / 10000) /* Centiseconds to Microseconds */
+
/* Short or Long XML Times */
#define XML_SHORT_TIME 1
#define XML_LONG_TIME 2
wp_flags wpt_flags;
const char *icon_descr;
time_t creation_time; /* standardized in UTC/GMT */
- int centiseconds; /* Optional hundredths of a second. */
+ int microseconds; /* Optional millionths of a second. */
/*
* route priority is for use by the simplify filter. If we have
- pvt->leap_scnds;
wptimes = floor(wptime);
wpt->creation_time = wptimes;
- wpt->centiseconds = 100.0 * (wptime - wptimes);
+ wpt->microseconds = 1000000.0 * (wptime - wptimes);
/*
* The Garmin spec fifteen different models that use a different
/* %%% local vars %%% */
-/* static char gdb_release[] = "$Revision: 1.46 $"; */
-static char gdb_release_date[] = "$Date: 2007/02/06 23:24:14 $";
+/* static char gdb_release[] = "$Revision: 1.47 $"; */
+static char gdb_release_date[] = "$Date: 2007/02/14 14:25:36 $";
static FILE *fin, *fout;
static char *fin_name, *fout_name;
wpt->latitude = GPS_Math_Semi_To_Deg(xlat);
wpt->longitude = GPS_Math_Semi_To_Deg(xlon);
wpt->creation_time = xtime;
- wpt->centiseconds = 0;
+ wpt->microseconds = 0;
wpt->altitude = xalt;
wpt->depth = xdepth;
tm.tm_mday = dmy % 100;
waypt->creation_time = mkgmtime(&tm);
- waypt->centiseconds = fracsecs;
+ waypt->microseconds = CENTI_TO_MICRO(fracsecs);
if (latdir == 'S') latdeg = -latdeg;
waypt->latitude = ddmm2degrees(latdeg);
tm->tm_sec;
date = tm->tm_mday * 10000 + tm->tm_mon * 100 +
tm->tm_year;
- fracsec = waypointp->centiseconds;
+ fracsec = MICRO_TO_CENTI(waypointp->microseconds);
}
}
if (!tm) {
} else {
centisecs = 0;
}
- wpt_tmp->centiseconds = centisecs;
+ wpt_tmp->microseconds = CENTI_TO_MICRO(centisecs);
track_add_wpt(track_head, wpt_tmp);
}
/* 0 centiseconds */
if (trk_version >= 30) {
- c = wpt->centiseconds;
+ c = MICRO_TO_CENTI(wpt->microseconds);
gbfwrite(&c, 1, 1, mapsend_file_out);
}
}
thisWaypoint->latitude = GPS_Math_Semi_To_Deg(lat);
thisWaypoint->longitude = GPS_Math_Semi_To_Deg(lon);
thisWaypoint->creation_time = le_read32(&dateTime);
- thisWaypoint->centiseconds = 0;
+ thisWaypoint->microseconds = 0;
thisWaypoint->altitude = mps_altitude;
thisWaypoint->depth = mps_depth;
track_add_wpt(track_head, thisWaypoint);
if (time->tm_year == 0)
{
wpt->creation_time = ((((time_t)time->tm_hour * 60) + time->tm_min) * 60) + time->tm_sec;
- if (wpt->centiseconds == 0)
+ if (wpt->microseconds == 0)
{
- wpt->centiseconds++;
+ wpt->microseconds++;
without_date++;
}
}
else
{
wpt->creation_time = mkgmtime(time);
- if (wpt->centiseconds != 0)
+ if (wpt->microseconds != 0)
{
- wpt->centiseconds = 0;
+ wpt->microseconds = 0;
without_date--;
}
}
{
waypoint *wpt = (waypoint *)elem;
- if (wpt->centiseconds != 0)
+ if (wpt->microseconds != 0)
{
time_t dt;
- wpt->centiseconds = 0; /* reset flag */
+ wpt->microseconds = 0; /* reset flag */
dt = (prev / SECONDS_PER_DAY) * SECONDS_PER_DAY;
wpt->creation_time += dt;
}
thisWaypoint->creation_time = dateTime;
- thisWaypoint->centiseconds = 0;
track_add_wpt(track_head, thisWaypoint);
if (gbfeof(psit_file)) break;
for (index = 0; index < count; index++) {
waypoint *wpt = list[index];
- if (wpt->centiseconds == 2) { /* log continued */
+ if (wpt->microseconds == 2) { /* log continued */
track = NULL;
}
if (track == NULL) {
track->rte_desc = xstrdup(rte_desc);
}
track_add_wpt(track, wpt);
- if (wpt->centiseconds == 1) { /* log pause */
+ if (wpt->microseconds == 1) { /* log pause */
track = NULL;
}
- wpt->centiseconds = 0;
+ wpt->microseconds = 0;
}
xfree(list);
case 10:
break;
case 11:
- if (what == 1) wpt->centiseconds = atoi(str); /* memory point type */
+ if (what == 1) wpt->microseconds = atoi(str); /* memory point type */
break;
}
}
while (c != NULL)
{
int new_what;
+ int fracsec;
switch(column)
{
break;
case 6:
- sscanf(c, "%d:%d:%d.%d", &time.tm_hour, &time.tm_min, &time.tm_sec, &wpt->centiseconds);
+ sscanf(c, "%d:%d:%d.%d", &time.tm_hour, &time.tm_min, &time.tm_sec, &fracsec);
+ wpt->microseconds = CENTI_TO_MICRO(fracsec);
if (what == STM_TRKPT)
- wpt->centiseconds /= 10;
+ wpt->microseconds /= 10;
break;
default:
{
case STM_WAYPT:
case STM_RTEPT:
- gbfprintf(fout, ".%02d", wpt->centiseconds);
+ gbfprintf(fout, ".%02d", MICRO_TO_CENTI(wpt->microseconds));
break;
case STM_TRKPT:
- gbfprintf(fout, ".%03d", wpt->centiseconds * 10);
+ gbfprintf(fout, ".%03d", MICRO_TO_CENTI(wpt->microseconds * 10));
break;
}
gbfprintf(fout, ",\r\n");
int via;
if (wpt_tmp == NULL) return;
- via = wpt_tmp->centiseconds;
- wpt_tmp->centiseconds = 0;
+ via = wpt_tmp->microseconds;
+ wpt_tmp->microseconds = 0;
if (via != 0)
waypt_add(wpt_tmp);
const char **avp = &attrv[0];
wpt_tmp = waypt_new();
- wpt_tmp->centiseconds = 0;
if ((waypoints == 1) || (waypoints == item_count))
- wpt_tmp->centiseconds++;
+ wpt_tmp->microseconds++;
waypoints++;
}
if ((0 == strcmp(avp[0], "ViaStation")) && (0 == strcmp(avp[1], "true")))
{
- wpt_tmp->centiseconds = 1;
+ wpt_tmp->microseconds = 1;
}
avp+=2;
}
tmStruct.tm_isdst =-1;
wpt_tmp->creation_time = mkgmtime(&tmStruct);
- wpt_tmp->centiseconds = fmod(100*seconds+0.5,100);
+ wpt_tmp->microseconds = fmod(1000000*seconds+0.5,1000000);
wpt_tmp->shortname =xcalloc(16,1);
snprintf(wpt_tmp->shortname, 15 , "WP%04d", ++serial);
position += sizeof(double);
tmstructp = gmtime(&waypointp->creation_time);
- seconds = (double) tmstructp->tm_sec + 0.01*waypointp->centiseconds;
+ seconds = (double) tmstructp->tm_sec + 0.0000001*waypointp->microseconds;
workbuffer[position++] =tmstructp->tm_year-100;
workbuffer[position++] =tmstructp->tm_mon+1;
wpt->longitude = lon;
wpt->altitude = alt;
wpt->creation_time = rtim;
- wpt->centiseconds = 0;
sprintf(wp_name, "WP%04d", ++st->wpn);
wpt->shortname = xstrdup(wp_name);